f0ab0baa694a942a3500ad73b7c1252b837d4e03
[git-annex.git] /
1 [[!comment format=mdwn
2  username="yarikoptic"
3  avatar="http://cdn.libravatar.org/avatar/f11e9c84cb18d26a1748c33b48c924b4"
4  subject="comment 2"
5  date="2023-04-24T19:23:22Z"
6  content="""
7 hm, I didn't look inside `git` but `git diff` is likely to have it escaped because `patch` (and/or other unified diff operating tools) expect it such. In other words -- `git diff` must encode paths escaped because the \"diff standard\" expects it such.
8
9 On the other hand, as you confirmed, `git add` just displays the name on the screen, and as such it does not bother escaping it since may be I just cut/paste it as a string which is \"raw\" and thus not expecting any escape characters.
10
11 RTFMing [git-config on core.quotePath](https://git-scm.com/docs/git-config#Documentation/git-config.txt-corequotePath)  I  spotted 
12
13 > ... enclosing the pathname in double-quotes and escaping ...
14
15 so it talks about double-quotes.  `git` `status`, `diff` report paths in double (`\"`) not single (`'`) quotes. I wonder if that is where/how `git` is consistent since in your example that is the difference too:
16
17 ```
18 # current master git-annex
19 joey@darkstar:~/tmp/xxx>git-annex add 'gl\orious'
20 git-annex: \"gl\\orious\" not found
21 joey@darkstar:~/tmp/xxx>git add 'gl\orious'
22 fatal: pathspec 'gl\orious' did not match any files
23 ```
24
25 that git uses `'` (and does not escape) while git annex uses `\"` (and escapes)?  Did you see git doing escaping in paths where it reports them within single (`'`) quotes?
26
27 and thus git-annex should have just wrapped in `'` to become consistent with git in :
28
29 ```shell
30 # released git-annex
31 > git annex add --json --json-error-messages '\e[31mfo\o\e[0m'
32 git-annex: \e[31mfo\o\e[0m not found
33 add: 1 failed
34 > git add '\e[31mfo\o\e[0m'
35 fatal: pathspec '\e[31mfo\o\e[0m' did not match any files
36 > git rm '\e[31mfo\o\e[0m'
37 fatal: pathspec '\e[31mfo\o\e[0m' did not match any files
38 ```
39
40
41 """]]